package cn.com.chengmandian.bike.controller;


import cn.com.chengmandian.bike.model.EbDepositCard;
import cn.com.chengmandian.bike.service.IEbDepositCardService;
import cn.com.chengmandian.core.web.pojo.AgentInfo;
import cn.com.chengmandian.core.web.pojo.AjaxResult;
import cn.com.chengmandian.core.web.utils.LocalMapUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 电单车运营-免押会员配置 前端控制器
 * </p>
 *
 * @author AutoGenerator
 * @since 2022-01-19
 */
@Api(tags = "免押会员相关接口")
@RestController
@RequestMapping("/deposit/card")
public class EbDepositCardController {
    @Autowired
    private IEbDepositCardService depositCardService;

    @ApiOperation("免押卡列表(无需登录)")
    @GetMapping("/list")
    public AjaxResult<List<EbDepositCard>> list() {
        AgentInfo agentInfo = LocalMapUtil.getAgentInfo();
        Assert.notNull(agentInfo.getAreaId(), "缺少运营区ID");
        return AjaxResult.success(depositCardService.getCardList(agentInfo.getAreaId()));
    }
}
